#include "StdAfx.h"
#include "qwindowpos.h"
 
 
using namespace micro::gui;
 

QWindowPos::QWindowPos(  int nWindows )
{
	m_hdwp = BeginDeferWindowPos(nWindows);
}

QWindowPos::~QWindowPos()
{
	EndDeferWindowPos(m_hdwp);
}
  
void QWindowPos::MoveWindow(HWND hWnd, int x, int y, int nWidth, int nHeight, bool bRepaint)
{
	UINT uFlags = SWP_NOACTIVATE|SWP_NOZORDER;// | SWP_NOSENDCHANGING;//| SWP_NOOWNERZORDER;
	if (!bRepaint)
		uFlags |= SWP_NOREDRAW;
	
	SetWindowPos(hWnd, nullptr, x, y, nWidth, nHeight, uFlags);	
}


void QWindowPos::MoveWindow(HWND hWnd,  QRect  rc, bool bRepaint)
{
	UINT uFlags = SWP_NOACTIVATE|SWP_NOZORDER;//  | SWP_NOSENDCHANGING; //|SWP_NOOWNERZORDER;
	if (!bRepaint)
		uFlags |= SWP_NOREDRAW;
	
	SetWindowPos(hWnd, nullptr, rc.left, rc.top, rc.Width(), rc.Height(), uFlags);	
}
void QWindowPos::SetWindowPos(HWND hWnd, HWND hWndAfter, int x, int y, int nWidth, 	int nHeight, UINT uFlags)
{
	if (m_hdwp != 0)
	{
		m_hdwp = DeferWindowPos(m_hdwp, hWnd, hWndAfter, x, y, nWidth, nHeight, uFlags);
	}
	
}

 